layui.use(['flow','jquery'], function(){
  var $ = layui.jquery;
  var flow = layui.flow;
  flow.load({
    elem: '#masonry'
    ,isAuto: false
    ,isLazyimg: true
    ,end: '更多图片请查看分类'
    ,done: function(page, next){
      setTimeout(function(){
      var lis = [];
      $.get('/api.php?op=ajax_append&modelid=3&p='+page, function(res){
        var data=eval("("+res+")");
        if(data.code == 1){ 
          var arr = Object.keys(data.list);
          for(var i = 0; i < arr.length; i++){   
            var str = data.list[i];
            str = str.replace(/&amp;/g, '&'); 
            str = str.replace(/&lt;/g, '<');
            str = str.replace(/&gt;/g, '>');
            //str = str.replace(/&quot;/g, "''");  
            str = str.replace(/&#039;/g, "'");
            str = str.replace(/&quot;/g, "\""); 
            lis.push(str);       	
          }
          next(lis.join(''), page < data.pagetotal);
        }else{
          return false;
        }
      });
   	  },500);
    }
  });
});